package com.gongj.infoconfigboot.controller;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public class TestController {

    @Autowired
    RabbitTemplate rabbitTemplate;

    @GetMapping("/send")
    public void send(String exchange,String key){
        CorrelationData correlation = new CorrelationData("设置：" + UUID.randomUUID().toString());
        rabbitTemplate.convertAndSend(exchange,key,"发送消息",correlation);
    }
}
